import { createRouter, createWebHistory } from 'vue-router';

// 学生路由
import StudentLogin from './views/auth/Login.vue';
import StudentRegister from './views/auth/Register.vue';
import StudentDashboard from './views/dashboard/StudentDashboard.vue';
import StudentClock from './views/attendance/StudentClock.vue';
import StudentLeave from './views/attendance/StudentLeave.vue';
import StudentRecords from './views/attendance/StudentRecords.vue';
import StudentEvents from './views/attendance/StudentEvents.vue';

// 教师路由
import TeacherLogin from './views/auth/Login.vue';
import TeacherDashboard from './views/dashboard/TeacherDashboard.vue';
import TeacherAttendance from './views/attendance/TeacherAttendance.vue';
import TeacherChat from './views/attendance/TeacherChat.vue';
import HomeworkManagement from './views/homework/HomeworkManagement.vue';
import HomeworkSubmissions from './views/homework/HomeworkSubmissions.vue';
import ExamManagement from './views/exam/ExamManagement.vue';

// 家长路由
import ParentLogin from './views/auth/Login.vue';
import ParentDashboard from './views/dashboard/ParentDashboard.vue';
import ParentAttendance from './views/attendance/ParentAttendance.vue';
import ParentChat from './views/attendance/ParentChat.vue';
import ParentEvents from './views/attendance/ParentEvents.vue';

// 管理员路由
import AdminLogin from './views/auth/Login.vue';
import AdminDashboard from './views/dashboard/AdminDashboard.vue';
import AdminEvents from './views/attendance/AdminEvents.vue';

// 作业路由
import StudentHomework from './views/homework/StudentHomework.vue';

const routes = [
  { path: '/', redirect: '/login' },
  { path: '/login', component: StudentLogin },
  { path: '/register', component: StudentRegister },
  { path: '/student/dashboard', component: StudentDashboard },
  { path: '/student/clock', component: StudentClock },
  { path: '/student/leave', component: StudentLeave },
  { path: '/student/records', component: StudentRecords },
  { path: '/student/events', component: StudentEvents },
  { path: '/student/homework', component: StudentHomework },
  { path: '/teacher/login', component: TeacherLogin },
  { path: '/teacher/dashboard', component: TeacherDashboard },
  { path: '/teacher/attendance', component: TeacherAttendance },
  { path: '/teacher/chat', component: TeacherChat },
  { path: '/teacher/homework', component: HomeworkManagement },
  { path: '/teacher/homework/submissions/:assignmentId', component: HomeworkSubmissions, props: true },
  { path: '/teacher/exam', component: ExamManagement },
  { path: '/parent/login', component: ParentLogin },
  { path: '/parent/dashboard', component: ParentDashboard },
  { path: '/parent/attendance', component: ParentAttendance },
  { path: '/parent/chat', component: ParentChat },
  { path: '/parent/events', component: ParentEvents },
  { path: '/admin/login', component: AdminLogin },
  { path: '/admin/dashboard', component: AdminDashboard },
  { path: '/admin/events', component: AdminEvents },
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;